#!/usr/bin/env python
import socket
import itertools
import sys

from dm_reg import *
from dm_utils import *
from openocd import *

if __name__ == "__main__":
    hartid = int(sys.argv[1])
    with OpenOcd(verbose=False) as ocd:
        ocd.dmi_write_fields(dmcontrol, hartsello = hartid, resumereq = 0, haltreq = 0)
        ocd.dmi_write_fields(dmcontrol, hartsello = hartid, resumereq = 1, haltreq = 0)
        ocd.dmi_write_fields(dmcontrol, hartsello = hartid, resumereq = 0, haltreq = 0)
